#ifndef _geo_vector_h_
#define _geo_vector_h_

#include<math.h>

namespace contest
{

/**
 * 2D vector class
 * @template T: Type of coordinates (i.e. int, int64_t, float, double, fraction)
 **/
template <class T> class vector
{
public:
    T x;
    T y;
    vector(T px, T py): x(px), y(py)
    {
    }
    T dot(const vector<T>& rhs) const
    {
        return x*rhs.x + y*rhs.y;
    }
    T cross(const vector<T>& rhs) const
    {
        return x*rhs.y - rhs.x*y;
    }
    T abs() const
    {
        return sqrt(x*x + y*y);
    }
};
}

#endif
